<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        body{
            height: 100vh;
            /* 背景渐变色 */
            background: linear-gradient(#99f, #f99);

        }
        body,.navbar,.navbar ul{
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .navbar{
            position: relative;
            padding: 20px;
            border-radius: 50px;
            background-color: #fff;
        }
        .navbar input{
            width: 40px;
            height: 40px;
            cursor: pointer;
            opacity: 0;
        }
        .navbar span{
            position: absolute;
            left: 25px;
            /* 将两条线放在一起，然后单独设置第二条线的位置 */
            top: calc(50% - 10px);
            width: 30px;
            height: 4px;
            border-radius: 15px;
            background-color: #999;
            /* 解决 span覆盖复选框问题 */
            pointer-events: none;
            /* 收回过度 */
            transition: transform .3s ease-in-out, top .3s ease-in-out .3s;
        }
        .navbar span:nth-child(3){
            top: calc(50% + 6px);
        }
        .navbar ul{
            overflow: hidden;
            width:0;
            /* 盒子是扁的，原因是文字被换行显示 */
            /* 使文字一行排列 不换行 */
            white-space: nowrap;
            transition: all 0.5s;
        }
        .navbar ul li{
            list-style: none;
            margin:0 15px;
        }
        .navbar ul li a{
            text-decoration: none;
            font-size: 20px;
            font-weight: 700;
            color:#333;
        }
        /* : 属性 ~ 兄弟选择器 */
        .navbar input:checked ~ ul{
            width: 350px;
        }
        .navbar input:checked ~ span:nth-child(2){
            top: calc(50% - 2px);
            transform: rotate(-45deg);
            background-color: #fb7299;
            /* 先执行 top .3s 后 执行transform */
            transition: top .3s ease-in-out, transform .3s ease-in-out .3s;
        }
        .navbar input:checked ~ span:nth-child(3){
            top: calc(50% - 2px);
            transform: rotate(45deg);
            background-color: #fb7299;
            transition: all 0.5s;
            transition: top .3s ease-in-out, transform .3s ease-in-out .3s;
        }
    </style>
</head>
<body>
    <div class="navbar">
        <input type="checkbox">
        <span></span>
        <span></span>
        <ul>
            <li><a href="javascript:void(0)">点赞</a></li>
            <li><a href="javascript:void(0)">投币</a></li>
            <li><a href="javascript:void(0)">收藏</a></li>
            <li><a href="javascript:void(0)">关注</a></li>
            <li><a href="javascript:void(0)">分享</a></li>
        </ul>
    </div>
</body>
</html>